﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Configuration;

namespace ESF.MUP.BasePlatform
{
    /// <summary>
    /// Define the provider configuration element settings in the configuration file
    /// </summary>
    public class ConnectorConfigurationElement : System.Configuration.ConfigurationElement
    {

        public readonly System.Collections.Specialized.StringDictionary _properties = new System.Collections.Specialized.StringDictionary();

        protected override bool OnDeserializeUnrecognizedAttribute(string name, string value)
        {
            //return base.OnDeserializeUnrecognizedAttribute(name, value);
            _properties.Add(name, value);
            return true;
        }

        [ConfigurationProperty("name", IsRequired = true, IsKey = true)]
        public string Name
        {
            get
            {
                return (string)this["name"];
            }
            set
            {
                this["name"] = value;
            }
        }

        [ConfigurationProperty("assemblyPath", IsRequired = true)]
        //[RegexStringValidator(@"\w+:\/\/[\w.]+\S*")]
        public string AssemblyPath
        {
            get
            {
                return (string)this["assemblyPath"];
            }
            set
            {
                this["assemblyPath"] = value;
            }
        }

        [ConfigurationProperty("Type", IsRequired = true)]
        public string ConnectorType
        {
            get
            {
                return (string)this["Type"];
            }
            set
            {
                this["Type"] = value;
            }
        }

    }
}
